package com.dy.system.service.impl;

import com.dy.common.utils.DateUtils;
import com.dy.system.domain.FreshMedicalMachine;
import com.dy.system.mapper.FreshMedicalMachineMapper;
import com.dy.system.service.IFreshMedicalMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 设备信息Service业务层处理
 *
 * @author ruoyi
 * @date 2022-08-16
 */
@Service
public class FreshMedicalMachineServiceImpl implements IFreshMedicalMachineService {
    @Autowired
    private FreshMedicalMachineMapper freshMedicalMachineMapper;

    /**
     * 查询设备信息
     *
     * @param id 设备信息主键
     * @return 设备信息
     */
    @Override
    public FreshMedicalMachine selectFreshMedicalMachineById(Long id) {
        return freshMedicalMachineMapper.selectFreshMedicalMachineById(id);
    }

    /**
     * 查询设备信息列表
     *
     * @param freshMedicalMachine 设备信息
     * @return 设备信息
     */
    @Override
    public List<FreshMedicalMachine> selectFreshMedicalMachineList(FreshMedicalMachine freshMedicalMachine) {
        return freshMedicalMachineMapper.selectFreshMedicalMachineList(freshMedicalMachine);
    }

    /**
     * 新增设备信息
     *
     * @param freshMedicalMachine 设备信息
     * @return 结果
     */
    @Override
    public int insertFreshMedicalMachine(FreshMedicalMachine freshMedicalMachine) {
        freshMedicalMachine.setCreateTime(DateUtils.getNowDate());
        return freshMedicalMachineMapper.insertFreshMedicalMachine(freshMedicalMachine);
    }

    /**
     * 修改设备信息
     *
     * @param freshMedicalMachine 设备信息
     * @return 结果
     */
    @Override
    public int updateFreshMedicalMachine(FreshMedicalMachine freshMedicalMachine) {
        freshMedicalMachine.setUpdateTime(DateUtils.getNowDate());
        return freshMedicalMachineMapper.updateFreshMedicalMachine(freshMedicalMachine);
    }

    /**
     * 批量删除设备信息
     *
     * @param ids 需要删除的设备信息主键
     * @return 结果
     */
    @Override
    public int deleteFreshMedicalMachineByIds(Long[] ids) {
        return freshMedicalMachineMapper.deleteFreshMedicalMachineByIds(ids);
    }

    /**
     * 删除设备信息信息
     *
     * @param id 设备信息主键
     * @return 结果
     */
    @Override
    public int deleteFreshMedicalMachineById(Long id) {
        return freshMedicalMachineMapper.deleteFreshMedicalMachineById(id);
    }

    @Override
    public FreshMedicalMachine selectMedicalMachineByCode(String code) {
        return freshMedicalMachineMapper.selectMedicalMachineByCode(code);
    }

    @Override
    public Integer findMachineCount(Long id) {
        return freshMedicalMachineMapper.findMachineCount(id);
    }

    @Override
    public FreshMedicalMachine selectFreshMedicalMachineByInstitutionId(Long id) {
        return freshMedicalMachineMapper.selectFreshMedicalMachineByInstitutionId(id);
    }
}
